package org.jground.rx.def.apps.knowledge;
import org.jground.rx.*;
import org.jground.rx.gen.*;
import org.jground.util.*;
import java.util.List;
import org.jground.rx.def.apps.accounting.*;
import org.jground.rx.def.apps.commons.*;
import org.jground.rx.def.*;
import org.jground.rx.def.apps.crm.*;
import org.jground.rx.def.apps.cip.*;
import org.jground.rx.def.apps.core.*;
import org.jground.rx.def.apps.legal.*;
import org.jground.rx.def.apps.ipm.*;
@SuppressWarnings("unused")
public class Context extends GenRoot {

    public static final String moid = "org.jground.rx.def.apps.knowledge.Context";

    private static final String clients ="clients";
    private static final String tags ="tags";
    private static final String $CREATOR ="$CREATOR";

    public static final class AttName {
        public static final String clients ="clients";
        public static final String tags ="tags";
        public static final String $CREATOR ="$CREATOR";
    }

    public static Context createNew() { return new Context(RXObjectService.getInstance().create(moid)); }

    public static Context getById(String oid) { 
        IRXObject mod = RXObjectService.getInstance().getById(oid);
        if(mod == null) { return null; }
        return new Context(mod);
    }

    public static Context[] getByIds(String... oids) { 
        List<IRXObject> mods = RXObjectService.getInstance().getByIds(moid, oids);
        Context[] res = new Context[mods.size()];
        int i = 0;
        for(IRXObject mod : mods) {
            res[i] = new Context(mod);
            i++;
        }
        return res;
    }

    public static SearchCriteria newSearchCriteria() {
        return  SearchCriteria.create(moid);
    }

    public static Context[] search(SearchCriteria sc) {
        return  wrap(GenRoot._search(sc));
    }

    public static Context[] wrap(List<? extends IRXObjectSynopsis> mods) { 
        Context[] res = new Context[mods.size()];
        int i = 0;
        for(IRXObjectSynopsis mod : mods) {
            res[i] = new Context(mod);
            i++;
        }
        return res;
    }

    public static Context wrap(IRXObjectSynopsis mod) { 
        return new Context(mod);
    }

    private Context(IRXObjectSynopsis rxObject) {this.rxObject = (IRXObject) rxObject;}

    public static String getClientsLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, clients).getLabel();
    }

    public static String getClientsDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, clients).getDescription();
    }

    public void setClients(org.jground.rx.def.apps.core.Institution value) {
        rxObject.set(clients, _to_String(value));
    }

    public org.jground.rx.def.apps.core.Institution getClients() {
        return org.jground.rx.def.apps.core.Institution.getById(rxObject.getCurrentValue(clients));
    }

    public static String getTagsLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, tags).getLabel();
    }

    public static String getTagsDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, tags).getDescription();
    }

    public void addTags(String... string) {
        rxObject.set(tags, _to_String(string));
    }

    public void setTags(String[] strings) {
        rxObject.set(tags, _to_String(strings));
    }

    public int getTagsSize() {
        return StringUtils.rnn(rxObject.getValues(tags)).length;
    }

    public String[] getTags() {
        return _to_String(rxObject.getValues(tags));
    }

    public String getTags(int index) {
        return _to_String(rxObject.getValues(tags))[index];
    }

    public static String get$CREATORLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, $CREATOR).getLabel();
    }

    public static String get$CREATORDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, $CREATOR).getDescription();
    }

    public void set$CREATOR(String string) {
        rxObject.set($CREATOR, _to_String(string));
    }

    public String get$CREATOR() {
        return _to_String(rxObject.getCurrentValue($CREATOR));
    }

}
